<template>
  <d2-container>

<!--    <el-dialog-->
<!--            title="更新学生状态"-->
<!--            :visible.sync="dialogVisibleStatus"-->
<!--            width="30%"-->
<!--    >-->
<!--      <span>选择出勤状态</span>-->
<!--      <span slot="footer" class="dialog-footer">-->
<!--                          <el-select v-model="dialog_status" placeholder="请选择">-->
<!--                          <el-option-->
<!--                                  v-for="item in option.studentRecordStatus"-->
<!--                                  :key="item.value"-->
<!--                                  :label="item.name"-->
<!--                                  :value="item.value">-->
<!--                          </el-option>-->
<!--                        </el-select>-->

<!--                        <el-button @click="dialogVisibleStatus = false">取 消</el-button>-->
<!--                        <el-button type="primary" @click="updateStudentRecord">确 定</el-button>-->
<!--                      </span>-->

<!--    </el-dialog>-->


    <el-tabs type="card">

      <el-tab-pane label="教师信息">
        <el-main>


          <div>
            <h3 style="display: inline-block;">员工姓名:{{staff.info.name}}</h3>
          </div>

          <div>
            <h3 style="display: inline-block;">当前负责班级：{{staff.info.class.map(value=>value.name).join(',')}}</h3>
          </div>

          <div>
            <h3 style="display: inline-block;">当前职位：{{staff.info.position.map(value=>value.name).join(',')}}</h3>
          </div>


          <h3 style="display: inline-block;margin-top: 5vw">任教历史</h3>


          <el-table :data="staff.info.history" border style="width: 100%;">
            <el-table-column prop="name" label="班级"></el-table-column>
            <el-table-column prop="school.name" label="学校"></el-table-column>
            <el-table-column prop="startDate" label="开始时间"></el-table-column>
            <el-table-column prop="endDate" label="结束时间"></el-table-column>
          </el-table>


        </el-main>
      </el-tab-pane>
    </el-tabs>
  </d2-container>
</template>


<script>
  import request from "@/plugin/axios";
  export default {
    data() {
      return {

        staff_id:undefined,
        staff:{
          info : undefined,
        }

      };
    },
    methods: {
      getStaffInfo() {
        request({
          url: "/staff/getStaffOne",
          method: "post",
          data: {id: this.staff_id}
        }).then(res => {
          if (res.code == 200) {
            this.staff.info = res.data
            console.log(res.data)
          }
        });
      }
    },

    created() {
      if (this.$route.query.id != undefined) {
        this.staff_id = this.$route.query.id;
        this.getStaffInfo()
      }
    }
  }


</script>
